package o;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
import huawei.widget.HwSubTabWidget;
import java.lang.ref.WeakReference;

public class cho implements OnPageChangeListener {
    private boolean ˊ = false;
    private WeakReference<HwSubTabWidget> ˎ;
    private WeakReference<cha> ˏ;
    private int ॱ = -1;

    public cho(HwSubTabWidget hwSubTabWidget, cha o_cha) {
        this.ˎ = new WeakReference(hwSubTabWidget);
        this.ˏ = new WeakReference(o_cha);
    }

    public void onPageScrolled(int i, float f, int i2) {
        int i3;
        HwSubTabWidget hwSubTabWidget;
        cha o_cha;
        int i4;
        Fragment ॱ;
        if (this.ˊ) {
            if (this.ॱ > i2) {
                i3 = -1;
            } else if (this.ॱ < i2) {
                i3 = 1;
            }
            this.ॱ = i2;
            if (this.ˎ != null) {
                hwSubTabWidget = (HwSubTabWidget) this.ˎ.get();
                if (hwSubTabWidget != null) {
                    hwSubTabWidget.setSubTabScrollingOffsets(i, f);
                }
            }
            if (this.ˏ != null) {
                o_cha = (cha) this.ˏ.get();
                if (o_cha == null) {
                }
                if (i3 == 1) {
                    i4 = i + 1;
                    ॱ = o_cha.ॱ(i4);
                    if (ॱ instanceof cid) {
                        o_cha.ˋ(i4);
                    } else {
                        ((cid) ॱ).ॱᐝ(0);
                    }
                } else if (i3 == -1) {
                    i4 = i - 1;
                    ॱ = o_cha.ॱ(i4);
                    if (ॱ instanceof cid) {
                        o_cha.ˋ(i4);
                    } else {
                        ((cid) ॱ).ॱᐝ(0);
                    }
                }
            }
        }
        i3 = 0;
        this.ॱ = i2;
        if (this.ˎ != null) {
            hwSubTabWidget = (HwSubTabWidget) this.ˎ.get();
            if (hwSubTabWidget != null) {
                hwSubTabWidget.setSubTabScrollingOffsets(i, f);
            }
        }
        if (this.ˏ != null) {
            o_cha = (cha) this.ˏ.get();
            if (o_cha == null) {
                if (i3 == 1) {
                    i4 = i + 1;
                    ॱ = o_cha.ॱ(i4);
                    if (ॱ instanceof cid) {
                        o_cha.ˋ(i4);
                    } else {
                        ((cid) ॱ).ॱᐝ(0);
                    }
                } else if (i3 == -1) {
                    i4 = i - 1;
                    ॱ = o_cha.ॱ(i4);
                    if (ॱ instanceof cid) {
                        o_cha.ˋ(i4);
                    } else {
                        ((cid) ॱ).ॱᐝ(0);
                    }
                }
            }
        }
    }

    public void onPageScrollStateChanged(int i) {
        if (this.ˎ != null) {
            HwSubTabWidget hwSubTabWidget = (HwSubTabWidget) this.ˎ.get();
            if (hwSubTabWidget != null) {
                hwSubTabWidget.setSubTabSelected(i);
            }
        }
    }

    public void onPageScrolled(int i) {
        if (i == 1) {
            this.ˊ = true;
        } else {
            this.ˊ = false;
        }
    }
}
